﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace SignalRApplication.Contracts
{
    public interface ISignalRAppService
    {
        /// <summary>
        /// 获取游戏详细信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<GameDetailDto> GetGame(Guid id);
        /// <summary>
        /// 创建游戏
        /// </summary>
        /// <param name="playerName">玩家用户名</param>
        /// <param name="description">游戏描述</param>
        /// <param name="gametype">游戏类型</param>
        /// <param name="gamesubtype">子类型</param>
        /// <param name="inturn">是否轮流作答</param>
        /// <param name="gamecondition">游戏条件</param>
        /// <returns></returns>
        Task<GameDetailDto> CreateGame(string playerName, string description, string gametype, string gamesubtype, bool inturn, string gamecondition);
        /// <summary>
        /// 加入游戏
        /// </summary>
        /// <param name="playername">玩家用户名</param>
        /// <param name="gameid">游戏Id</param>
        /// <returns></returns>
        Task<string> JoinGame(string playername, Guid gameid);
        /// <summary>
        /// 开始游戏
        /// </summary>
        /// <param name="playername">玩家用户名</param>
        /// <param name="gameid">游戏Id</param>
        /// <returns></returns>
        Task<string> StartGame(string playername, Guid gameid);
        /// <summary>
        /// 离开游戏
        /// </summary>
        /// <param name="playername">玩家用户名</param>
        /// <param name="gameid">游戏Id</param>
        /// <returns></returns>
        Task<string> LeaveGame(string playername, Guid gameid);
        /// <summary>
        /// 删除游戏
        /// </summary>
        /// <param name="gameid">游戏Id</param>
        /// <returns></returns>
        Task RemoveGame(Guid gameid);
        /// <summary>
        /// 获取玩家
        /// </summary>
        /// <param name="name">玩家用户名</param>
        /// <returns></returns>
        Task<PlayerDto> GetPlayerByUserName(string name);
        /// <summary>
        /// 设置作答玩家
        /// </summary>
        /// <param name="playername">玩家用户名</param>
        /// <param name="gameid">游戏Id</param>
        /// <returns></returns>
        Task<string> SetAnswerPlayer(string playername, Guid gameid);
        /// <summary>
        /// 进行游戏
        /// </summary>
        /// <param name="playername">玩家用户名</param>
        /// <param name="gameid">游戏Id</param>
        /// <param name="answer">作答</param>
        /// <returns></returns>
        Task<string> PlayGame(string playername, Guid gameid, string answer);
        /// <summary>
        /// 获取玩家可以参与的游戏，包括可以参加的游戏和已参加正在运行的游戏
        /// </summary>
        /// <param name="playername">玩家用户名</param>
        /// <returns></returns>
        Task<List<GameDto>> GetCanPlayGames(string playername);
        /// <summary>
        /// 获取玩家参与的游戏
        /// </summary>
        /// <param name="playername">玩家用户名</param>
        /// <returns></returns>
        Task<List<GameDto>> GetPlayerGames(string playername);
        /// <summary>
        /// 检查是否存在玩家
        /// </summary>
        /// <param name="playername">玩家用户名</param>
        /// <returns></returns>
        Task<bool> CheckPlayer(string playername);
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="playername">玩家用户名</param>
        /// <returns></returns>
        Task<string> AddPlayer(string playername, string nickname);
        /// <summary>
        /// 用户出局
        /// </summary>
        /// <param name="playername">玩家用户名</param>
        /// <param name="gameid">游戏Id</param>
        /// <returns></returns>
        Task SetPlayerOut(string playername, Guid gameid);
        /// <summary>
        /// 游戏结束
        /// </summary>
        /// <param name="gameguid">游戏Id</param>
        /// <returns></returns>
        Task GameOver(Guid gameguid);
        /// <summary>
        /// 修改昵称
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task UpdateNickName(UpdateNickNameDto dto);
    }
}
